var cheerio = require('cheerio');
var http = require('http')
var fs = require('fs')
var options = 'http://www.sysu.edu.cn/2012/cn/jgsz/yx/index.htm';
var htmlData = ''

// var req = http.request(options,function(res){
// 	res.on('data',function(chunk){
// 		htmlData += chunk
// 	})
// 	res.on('end',function(){
// 		var $ = cheerio.load(htmlData)
// 		var textcontent = $('tr').text()
// 		fs.writeFile('./school.txt',textcontent,'utf-8')
// 	})
// })
var req = http.request(options)
req.on('response',function(res){
	res.on('data',function(chunk){
		htmlData += chunk
	})
	res.on('end',function(){
		var $ = cheerio.load(htmlData)
		var textcontent = $('tr').text()
		fs.writeFile('./school.txt',textcontent,'utf-8')
	})
})

req.end()






























